


var toMySpokesman= function(){
	window.location = WST.U('WebApp/Agency/MySpokesman');
}


 
            var oSpan = document.getElementsByTagName('span')[0];
             var oSpan1 = document.getElementById('draw-a1');
             
		   function tow(n) {
		    	return n >= 0 && n < 10 ? '0' + n : '' + n;
		   }
		 	function getDate() {
		 		var effectedTime=$('#effectedTime').val();
					var effectedTime=effectedTime*1000;
					    var oDate = Number(new Date());//获取现在日期对象
						//var oldTime = oDate.getTime();//现在距离1970年的毫秒
				console.log( oDate);
						var newDate = new Date("effectedTime");//获取指定日期对象
						//var newTime = newDate.getTime();//2018年距离1970年的毫秒数
				       //var oldtime1=  new Date(oldTime);
                //
				console.log( effectedTime);
				//console.log( oldtime1);

						var second = Math.floor((effectedTime -oDate) / 1000);//未来时间距离现在的秒数
				console.log(second);
						var day = Math.floor(second / 86400);//整数部分代表的是天；一天有24*60*60=86400秒 ；
						second = second % 86400;//余数代表剩下的秒数；
						var hour = Math.floor(second / 3600);//整数部分代表小时；
						second %= 3600; //余数代表 剩下的秒数；
						var minute = Math.floor(second / 60);
						second %= 60;
							  if(second>=0||day>=0||hour>=0||minute>=0||second>=0){
						      var str = tow(day) + '<span class="time">天零</span>'
								+ tow(hour) + '<span class="time">:</span>'
								+ tow(minute) + '<span class="time">:</span>'
								+ tow(second) + '<span class="time"></span>';
							  oSpan.innerHTML=str;
							  }else{
					        oSpan.innerHTML='优惠券已失效';
						  }
						   
     }	 
getDate()
setInterval(getDate, 1000);


	function button(){
		var param={};
		param.couponId=1;
		//	param.userId=$('#userId').val();
		//	param.bookType=$('#bookType').val();
		url=WST.U('WebApp/Agency/checkcoupon');
		//	alert(url)
		$.post(url,param,function(data){
//			alert(JSON.stringify(data))
					if(data.status==1){
						window.location.href=WST.U('WebApp/Agency/Mycoupon');
					}

				}
		)

	}

